]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
timeLimitsManager: Convert unix times to ISO 8601
authorIgnacy Kuchciński <ignacykuchcinski@gnome.org>
Tue, 4 Nov 2025 22:07:54 +0000 (23:07 +0100)
committerIgnacy Kuchciński <ignacykuchcinski@gnome.org>
Wed, 5 Nov 2025 14:22:12 +0000 (15:22 +0100)
Convert unix epoch times to ISO 8601 formatted strings for logging
purposes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3841>

js/misc/timeLimitsManager.js

index 1fa2c46ac2c4b509f8dd894377e8d7cebe9cf0d7..b99939778a0cffa2b628b43f5708507cfd342d48 100644 (file)
@@ -467,7 +467,7 @@ export const TimeLimitsManager = GObject.registerClass({
 
         if (debugLog) {
             console.debug('TimeLimitsManager: User state changed from ' +
-                `${userStateToString(oldState)} to ${userStateToString(newState)} at ${wallTimeSecs}s`);
+                `${userStateToString(oldState)} to ${userStateToString(newState)} at ${this._unixToString(wallTimeSecs)}`);
         }
 
         // This potentially changed the limit time and timeout calculations.
@@ -751,6 +751,17 @@ export const TimeLimitsManager = GObject.registerClass({
         return 0;
     }
 
+    /**
+     * Convert unix epoch to ISO 8601 formatted string for logging purposes.
+     *
+     * @param {number} secs Unix time to represent in human readable form
+     * @returns {string}
+     */
+    _unixToString(secs) {
+        const dateTime = GLib.DateTime.new_from_unix_local(secs);
+        return dateTime.format_iso8601();
+    }
+
     _updateState() {
         console.assert(this._state !== TimeLimitsState.DISABLED,
             'Time limits should not be disabled when updating timer');